from awesum import Drawable, Cube, Vector3, Texture, Primitive, enum

from block import Block

class Paddle(Block):
	Setting = enum("NORMAL", "REVERSE", "HALF_LEFT", "HALF__MIDDLE", "HALF_RIGHT", "MINI")
	def __init__(self, v, type=0):
		super(Paddle, self).__init__(Drawable.Traits.GL | Drawable.Traits.COLL | Drawable.Traits.MOVE)
		self.origin = v
		self.type = Block.Type.BOOST #give the paddle the same effect as a boost block
	
	def load(self, game=None):
		super(Paddle, self).load(game)
		tex = self.game.scene.textures
		
		#Build a cube! Bounding box info is automatically generated
		#if self.type == Block.Type.BOOST:
		self.gl.createCube(Primitive.Paint.TEXTURE, [tex[1], 0, 1, 2])
		#else:
		#	self.gl.createCube(Primitive.Paint.COLOR, [(1,0,0)])
		
		self.gl.scaleV(Vector3(2., .25, 1.))
		
		#Our object causes collisions but doesn't need to react itself
		self.coll.fixed = True
	
	def moveLeft(self):
		self.origin.x -= .1
	
	def moveRight(self):
		self.origin.x += .1
	